package com.davies.learn.jbv.configuration;

import jakarta.validation.Configuration;
import org.springframework.boot.autoconfigure.validation.ValidationConfigurationCustomizer;

import org.springframework.stereotype.Component;

/**
 * @author davies
 * @date 2023/7/20 09:44
 */
@Component
public class FailFastValidationConfigurationCustomizer implements ValidationConfigurationCustomizer {

    /**
     * 快速失败
     * 当有一个参数校验不合格时,立即失败
     * <a href="https://docs.jboss.org/hibernate/stable/validator/reference/en-US/html_single/#section-provider-specific-settings">...</a>
     * @param configuration the configuration to customize
     */
    @Override
    public void customize(Configuration<?> configuration) {
        configuration.addProperty("hibernate.validator.fail_fast", "true");
    }
}
